package co.gov.mintic.Biblioteca.android;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;

public class Salir extends ImageButton {

	public Salir(Context context) {
		super(context);
	}

	public Salir(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public Salir(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public void init(final Activity activity) {
		setBackgroundColor(Color.TRANSPARENT);
		setOnClickListener(new ButtonLocalizarOnClickListener(activity));
	}

	private final class ButtonLocalizarOnClickListener implements
			OnClickListener {

		Activity activity;

		public ButtonLocalizarOnClickListener(Activity activity) {
			this.activity = activity;
		}

		public void onClick(View arg0) {
			activity.moveTaskToBack(true);
		}
	}

}
